<?php

namespace app\admin\model;

use think\Model;

/**
 * Urlgroup
 */
class Urlgroup extends Model
{
    // 表名
    protected $name = 'urlgroup';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 字段类型转换
    protected $type = [
        'keywords'        => 'json',
        'expiration_time' => 'timestamp:Y-m-d H:i:s',
    ];


    public function getKeywordsAttr($value): array
    {
        return !$value ? [] : json_decode($value, true);
    }
}